import React, { Component } from "react";
import {withRouter} from 'react-router-dom'
import {Layout, Dropdown, Space,Avatar}from 'antd';
import './topheader.scss';
import {
  UserOutlined,
} from '@ant-design/icons';
const {Header}=Layout;
const items = [
  {
    key: '1',
    label: '管理员'
  },
  {
    key: '2',
    danger: true,
    label: '退出',
  },
];
class TopHeader extends Component{
  handleclick=()=>{
    this.props.history.replace('/login');
  }
    render(){
        return (
         <>
         <Header
          style={{
            padding: 0,
            background: 'white',
          }}
        > 
          <div className="admi">
            <div className="home">首页</div>
            <div  className='rightWrapper'>
              <div className="rightWrapper-right"><span style={{marginRight:'30px'}} onClick={this.handleclick}>欢迎admi回来</span>
          <Dropdown menu={{ items }}>
          <a href='#/'>
           <Space>
           <Avatar size={40} icon={<UserOutlined />} />
           </Space>
           </a>
          </Dropdown>
          </div>         
  </div>          
  </div>
        </Header>
        </>
        )
    }
}
export default withRouter(TopHeader);